﻿using System;
using System.Collections;
using System.Web;
using System.Web.SessionState;

namespace NWebMock
{
    public interface IHttpSessionState : ICollection
    {
        #region Properties

        /// <summary>
        /// Gets or sets the character-set identifier for the current session.
        /// </summary>
        int CodePage { get; set; }

        /// <summary>
        /// Gets a reference to the current session-state object.
        /// </summary>
        HttpSessionState Contents { get; }

        /// <summary>
        /// Gets a value that indicates whether the application is configured for cookieless sessions.
        /// </summary>
        HttpCookieMode CookieMode { get; }

        /// <summary>
        /// Gets a value indicating whether the session ID is embedded in the URL or stored in an HTTP cookie.
        /// </summary>
        bool IsCookieless { get; }

        /// <summary>
        /// Gets a value indicating whether the session was created with the current request.
        /// </summary>
        bool IsNewSession { get; }

        /// <summary>
        /// Gets a value indicating whether the session is read-only.
        /// </summary>
        bool IsReadOnly { get; }

        /// <summary>
        /// Gets or sets a session value by numerical index.
        /// </summary>
        /// <param name="index">The numerical index of the session value.</param>
        /// <returns>The session-state value stored at the specified index, or null if the item does not exist.</returns>
        Object this[int index] { get; set; }

        /// <summary>
        /// Gets or sets a session value by name.
        /// </summary>
        /// <param name="name">The key name of the session value.</param>
        /// <returns>The session-state value with the specified name, or null if the item does not exist.</returns>
        Object this[string name] { get; set; }

        /// <summary>
        /// Gets a collection of the keys for all values stored in the session-state collection.
        /// </summary>
        ICollection Keys { get; }

        /// <summary>
        /// Gets or sets the locale identifier (LCID) of the current session.
        /// </summary>
        int LCID { get; set; }

        /// <summary>
        /// Gets the current session-state mode.
        /// </summary>
        SessionStateMode Mode { get; }

        /// <summary>
        /// Gets the unique identifier for the session.
        /// </summary>
        string SessionID { get; }

        /// <summary>
        /// Gets a collection of objects declared by <object Runat="Server" Scope="Session"/> tags within the ASP.NET application file Global.asax.
        /// </summary>
        HttpStaticObjectsCollection StaticObjects { get; }

        /// <summary>
        /// Gets and sets the amount of time, in minutes, allowed between requests before the session-state provider terminates the session.
        /// </summary>
        int Timeout { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Cancels the current session.
        /// </summary>
        void Abandon();

        /// <summary>
        /// Adds a new item to the session-state collection.
        /// </summary>
        /// <param name="name">The name of the item to add to the session-state collection.</param>
        /// <param name="value">The value of the item to add to the session-state collection.</param>
        void Add(string name, Object value);

        /// <summary>
        /// Removes all keys and values from the session-state collection.
        /// </summary>
        void Clear();

        /// <summary>
        /// Deletes an item from the session-state collection.
        /// </summary>
        /// <param name="name">The name of the item to delete from the session-state collection.</param>
        void Remove(string name);

        /// <summary>
        /// Removes all keys and values from the session-state collection.
        /// </summary>
        void RemoveAll();

        /// <summary>
        /// Deletes an item at a specified index from the session-state collection.
        /// </summary>
        /// <param name="index">The index of the item to remove from the session-state collection. </param>
        void RemoveAt(int index);

        #endregion
    }
}
